﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Student_View.aspx.vb" Inherits="Student_View" %>
<%@ Register TagName="Sc" TagPrefix="Sc" Src="Script.ascx" %>
<%@ Register TagName="Banner" TagPrefix="Banner" Src="Banner.ascx" %>
<%@ Register TagName="Navigation" TagPrefix="Navigation" Src="Navigation.ascx" %>
<%@ Register TagName="Footer" TagPrefix="Footer" Src="Footer.ascx" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="imagetoolbar" content="no" />
    <Sc:Sc ID="Sc1" runat="server" />
    <script type="text/javascript" src="resources/scripts/JScript.js"></script>
    <!--[if IE 6]>
<link href="Lecturer_view_files/axurerp_pagespecificstyles_ie6.css" type="text/css" rel="stylesheet">
<![endif]-->

    <title>Student View</title>
</head>
<body>
    <div class="main_container">
            <Banner:Banner ID="Banner1" runat="server" />
        <div class="contain_body">
            <Navigation:Navigation ID="Navigation1" runat="server" />
            <div class="details_contain">
                <form action="/Student_View.aspx" id="submitForm" method="post" runat="server">
                <input type="hidden" id="hiddenID" name="hiddenID" value="" />
                <input type="hidden" id="action" name="action" value="" />
                <input type="hidden" id="studentList" name="studentList" value="" />
                
                <div class="import">
                    <span class="title">IMPORT STUDENT</span>
                    <div class="tool">
                        Please Select Student information file for importing:
                        <br />
                        <br />
                        <input type="file" size="40" runat="server" id="readFile" name="readFile" />
                        <br />
                        <input class="import_button" type="button" value="Import" onclick="fImport();" />
                    </div>
                    <div style="overflow-x: scroll;">
                        <%
    If importdone.Trim <> "" Then
        Response.Write(importdone)
    End If
    If msg.Trim <> "" Then
        Response.Write(msg)
    End If
                        %>
                    </div>
                </div>
                <br />
                <div class="list">
                    <span class="title">STUDENT LIST</span>
                    <table class="Lecturer_List" style="border-collapse: collapse; margin: 10px 0 0 20px;
                        width: 804px;">
                        <tr>
                            <th>
                                Student ID
                            </th>
                            <th>
                                Name
                            </th>
                            <th>
                                Group
                            </th>
                            <th>
                                Area of Expertise
                            </th>
                            <th>
                                Occupation
                            </th>
                            <th>
                                Company
                            </th>
                            <th>
                                1st week Attendance
                            </th>
                            <th>
                                2nd week Attendance
                            </th>
                            <th>
                                Qualified(Y/N)
                            </th>
                            <th>
                                Remove
                            </th>
                        </tr>
                        <%  Try
                                
                            Dim bEdit As Boolean = False
                            Dim OutPut As New StringBuilder("")
                            Dim ds As DataSet = mDataStore.GetStudentList()
                            Dim dv As DataView
                            'get user identify to perform edit
                            If True Then
                                bEdit = True
                            Else
                                bEdit = False
                            End If
                            dv = ds.Tables(0).DefaultView
                            If dv.Count > 0 Then
                                    ' Loop through each row in the view.
                                    Dim w1, w2 As String
                                    For Each rowView As DataRowView In dv
                                        w1 = IIf(IsDBNull(rowView("Std_1stWkAttendance")), "False", rowView("Std_1stWkAttendance"))
                                        w2 = IIf(IsDBNull(rowView("Std_2ndWkAttendance")), "False", rowView("Std_2ndWkAttendance"))
                                        Dim sApprove As String = IIf(w1 = "True" And w2 = "True", "Y", "N")
                                        OutPut.Append("<tr>")
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_number"))
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_name"))
                                    
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_WPPGrp"))
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_Expertise"))
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_Position"))
                                        OutPut.AppendFormat("<td>{0}</td>", rowView("Std_Company"))
                                        OutPut.AppendFormat("<td>")
                                        If bEdit Then
                                            OutPut.AppendFormat("<input type='checkbox' id='{0}_{1}' name='{0}_{1}' {2} onblur=""EditStudentCheck('{0}');""/>", rowView("Std_number"), 1, IIf(w1 = "True", "checked='checked'", ""))
                                        End If
                                        OutPut.AppendFormat("</td>")
                                        OutPut.AppendFormat("<td>")
                                        If bEdit Then
                                            OutPut.AppendFormat("<input type='checkbox' id='{0}_{1}' name='{0}_{1}' {2} onblur=""EditStudentCheck('{0}');""/>", rowView("Std_number"), 2, IIf(w2 = "True", "checked='checked'", ""))
                                        End If
                                        OutPut.AppendFormat("</td>")
                                         
                                        OutPut.AppendFormat("<td class='{1}'>{0}</td>", sApprove, IIf(sApprove = "N", "reject_student", "approve_student"))
                                        OutPut.AppendFormat("<td>")
                                        If bEdit Then
                                            OutPut.AppendFormat("<input type='button' value='Remove' class='action_btn' onclick=""RemoveStudentClick('{0}', '{1}');""/>", rowView("Std_number"), rowView("Std_name"))
                                        End If
                                        OutPut.AppendFormat("</td>")
                                        OutPut.AppendFormat("</tr>")
                               
                                    Next
                                    Response.Write(OutPut.ToString)
                            Else
                                    Response.Write("<tr><td>There is no student</td></tr>")
                                
                                End If
                                
                            Catch ex As Exception
                                Response.Write(ex.Message)
                                'Response.Write(ex.StackTrace)
                            End Try
                        %>
                    </table>
                    <input class="save_attendance" type="button" name="btnSaveAttendance" value="Save Attendance" onclick="SaveAttendance();" />
                </div>
               </form>
            </div>
            <br />
        </div>
        <br clear="all" />
        <Footer:Footer ID="Footer" runat="server" />
    </div>
</body>
</html>
